
package com.meteor.raft.util;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import java.net.InetAddress;
import java.net.UnknownHostException;


/**
 * 网络工具类
 */
@Component
public class NetUtils {

    @Value("${server.port}")
    private String port;

    private static String serverAddress = null;

    public  String localServer() {
        try {
            return InetAddress.getLocalHost().getHostAddress()+":"+port;
        } catch (UnknownHostException e) {
            e.printStackTrace();
            return null;
        }
    }

}
